package com.orm.analysis.service.impl;

import com.orm.analysis.dao.impl.PerfAnalysisDAO;
import com.orm.analysis.model.PerfAnalysis;
import com.orm.analysis.service.GenericService;
import org.apache.log4j.Logger;

import java.io.IOException;
import java.text.ParseException;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: saman
 * Date: 10/10/13
 * Time: 11:54 AM
 * To change this template use File | Settings | File Templates.
 */

public class PerfAnalysisService implements GenericService<PerfAnalysis> {


    private static Logger log = Logger.getLogger(PerfAnalysisService.class);


    private PerfAnalysisDAO dao;


    public PerfAnalysisDAO getDao() {
        return dao;
    }

    public void setDao(PerfAnalysisDAO dao) {
        this.dao = dao;
    }

    public  PerfAnalysis create(PerfAnalysis entity) {
        dao.save(entity);
        return entity;
    }


    public void delete(Object id) {

        dao.delete(id);
    }

    public PerfAnalysis update(PerfAnalysis entity) {
        dao.update(entity);
        return entity;
    }

    public List<PerfAnalysis> list(int page, int size) {
        return dao.list(page, size);
    }

    public List<PerfAnalysis> listByFields(String... fieldsNamesValues) {
        StringBuffer queryString= new StringBuffer("select a from PerfAnalysis a ");
        return dao.listByFields(queryString,fieldsNamesValues);
    }

    public List<PerfAnalysis> findAllWithDepth(String... fetchRelations) {
        return dao.findAllWithDepth(PerfAnalysis.class,fetchRelations);
    }

    public PerfAnalysis findWithDepth(String pkFieldName, Object id, String... fetchRelations) {
        return dao.findWithDepth(PerfAnalysis.class,pkFieldName,fetchRelations);
    }
    public  int updateExecuteUpdateByQuery(String query){
           return dao.updateExecuteUpdateByQuery(query);
    }

    public PerfAnalysis getById(PerfAnalysis entity) {
        return dao.getById(entity.getId());
    }

    public PerfAnalysis getById(Integer id) {
        return dao.getById(id);
    }

    public void executeImproter() throws ParseException, IOException {
        //To change body of implemented methods use File | Settings | File Templates.
    }


    public List<Integer> getIdList(){

        return dao.findIdList();
    }

    public void processTaskExecutor() {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public List<PerfAnalysis> getByIdList(Integer[] entityIdList) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }


}
